<div class="header-nav">
    <nav class="nav">
        <ul class="nav_left">
            <li><a href="#">帮助中心</a></li>
            <li><a href="S#">收藏</a></li>
            <li><a href="../index.html">360官网</a></li>
            <li><a href="#">360智慧生活</a></li>
        </ul>
        <a class="gwc" href="../html/cart.html"><i class="iconfont icon-gouwuche"></i></a>
        <!-- <div class="nav_right">
            <a href="../html/login.html">登录</a>
            <a href="../html/register.html">注册</a>
        </div> -->
        <section>
            <span>欢迎：熊浩</span>
            <b>退出</b>
            <a class="logBtn" href="/html/login.html">登录</a>
            <a class="regBtn" href="/html/register.html">注册</a>
        </section>
    </nav>
</div>
<div class="header-search">
    <div class="searchAll">
        <div class="logo"><a href="../index.html">360商城</a></div>
        <div class="search_left">
            <a href="../html/newList.html">新品推荐</a>
            <a href="../html/hotList.html">热卖榜单</a>
        </div>
        <div class="search_right">
            <input type="search" placeholder="">
            <button>搜索</button>
            <ul>
                <li><a href="#">记录仪</a></li>
                <li><a href="#">摄像机</a></li>
                <li><a href="#">路由器</a></li>
                <li><a href="#">耳机</a></li>
                <li><a href="#">扫地机</a></li>
                <li><a href="#">智能手表</a></li>
            </ul>
        </div>
    </div>
</div>

<script src="/js/cookie.js"></script>
<script>
    let span = document.querySelector('span')
    let b = document.querySelector('b')
    let logBtn = document.querySelector('.logBtn')
    let regBtn = document.querySelector('.regBtn')

    if(getCookie('username')){
        logBtn.style.display = 'none'
        regBtn.style.display = 'none'
        span.style.display = 'block'
        b.style.display = 'block'
        span.innerHTML = `欢迎：${getCookie('username')}`
    }
    b.onclick = ()=>{
        delCookie('username')
        logBtn.style.display = 'block'
        regBtn.style.display = 'block'
        span.style.display = 'none'
        b.style.display = 'none'
    }
</script>